package com.css.crm.dao.impl;

import java.util.List;

import org.apache.ibatis.session.SqlSession;

import com.css.crm.dao.RegisterDao;
import com.css.crm.vo.RegisterVo;

/**
 * Implementation for RegisterDao
 * 
 * @author ais
 */
public class RegisterDaoImpl extends BaseDaoImpl implements RegisterDao {

	public RegisterDaoImpl() {
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.css.crm.dao.RegisterDao#getRegisterById(java.lang.Long)
	 */
	@Override
	public RegisterVo getRegisterById(Long id) {

		SqlSession session = getMyBatisSession();
		return session.selectOne("register.getRegisterById", id);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.css.crm.dao.RegisterDao#deleteRegisterById(java.lang.Long)
	 */
	@Override
	public int deleteRegisterById(Long id) {

		SqlSession session = getMyBatisSession();
		return session.delete("register.deleteRegisterById", id);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.css.crm.dao.RegisterDao#insertRegister(com.css.crm.vo.RegisterVo)
	 */
	@Override
	public int insertRegister(RegisterVo vo) {

		SqlSession session = getMyBatisSession();
		return session.insert("register.insertRegister", vo);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.css.crm.dao.RegisterDao#updateRegister(com.css.crm.vo.RegisterVo)
	 */
	@Override
	public int updateRegister(RegisterVo vo) {

		SqlSession session = getMyBatisSession();
		return session.update("register.updateRegister", vo);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.css.crm.dao.RegisterDao#queryRegister(com.css.crm.vo.RegisterVo)
	 */
	@Override
	public List<RegisterVo> queryRegister(RegisterVo vo) {

		SqlSession session = getMyBatisSession();
		return session.selectList("register.queryRegister", vo);
	}

}
